home *** CD-ROM | disk | FTP | other *** search
/ com!online 2005 May / com_0505_1.iso / opensource / top10 / amc_install.exe / {app} / Scripts / Animeka (FR).ifs < prev    next >
Encoding:
Text File  |  2004-11-18  |  27.6 KB  |  860 lines

  1. // GETINFO SCRIPTING
  2. // Animeka.com - Recherche d'Animes (donnΘes, Θpisodes, et images) - by ScorEpioN
  3.  
  4. (***************************************************
  5.  *  Script d'importation pour :                    *
  6.  *  Animeka , http://www.animeka.com               *
  7.  *                                                 *
  8.  *  Script by ScorEpioN                            *
  9.  *                                                 *
  10.  *  Version : 17 - Update du 15/11/2004            *
  11.  *                                                 *
  12.  *  A utiliser avec Ant Movie Catalog 3.4.0        *
  13.  *  www.ant.be.tf/moviecatalog ╖╖╖ www.buypin.com  *
  14.  *                                                 *
  15.  *  The source code of the script can be used in   *
  16.  *  another program only if full credits to        *
  17.  *  script author and a link to Ant Movie Catalog  *
  18.  *  website are given in the About box or in       *
  19.  *  the documentation of the program               *
  20.  ***************************************************)
  21.  
  22. program ANIMEKA_SEARCH;
  23.  
  24. const
  25.   ConfirmTitre = 0;
  26.     { 0: Demande le titre avant de lancer le script
  27.       1: Ne demande pas le titre avant de lancer le script , met aucun resultat dans adresse web, 2: idem et met rΘsutlats multiples }
  28.   // Pour rΘcupΘrer ou non un champs
  29.   TitreOrignalConst = True;
  30.   TitreTraduitConst = True;
  31.   RealisateurConst = True;
  32.   StudioConst = True;
  33.   PaysConst = True;
  34.   CategorieConst = True;
  35.   AnneeConst = True;
  36.   DureeConst = True;
  37.   AdresseWebConst = True;
  38.   SynopsisConst = True;
  39.   EpisodeConst = True;
  40.  
  41. var
  42.   MovieName, NomFilm, la_liste, premiere_pageEpisode, Reponse : string;
  43.   premiereExecution : Integer;
  44.  
  45. // Pour debug : showmessage();
  46.  
  47. //------------------------------------------------------------------------------
  48. // ANALYSE DE LA PAGE DE RECHERCHES
  49. //------------------------------------------------------------------------------
  50.  
  51. procedure AnalyzePage(Address: string);
  52. var
  53.   Page: TStringList;
  54.   LineNr: Integer;
  55.   Line,page_film,titre_film, realisateur_film, annee_film : string;
  56.   BeginPos, EndPos, compteur : Integer;
  57.   begin
  58. //vide la liste des films
  59.   PickTreeClear;
  60. //charge la page
  61.   Line := GetPage(Address);
  62.  
  63. //teste si il y a des films trouvΘs
  64.   BeginPos := Pos('Aucuns r', Line);
  65.   if BeginPos <> 0 then  
  66.   begin
  67.     if (ConfirmTitre = 0) then
  68.     begin
  69.     titre_film := MovieName;
  70.     titre_film := StringReplace(titre_film, #13#10, '');
  71.     titre_film := StringReplace(titre_film, '   ', '');
  72.     titre_film := Trim(titre_film);
  73.     titre_film := AnsiLowerCase(titre_film);
  74.     titre_film := AnsiUpFirstLetter(titre_film);
  75.     showmessage('Aucun Anime trouvΘ pour : ' + titre_film);
  76.     exit;
  77.     end else
  78.     begin
  79.     SetField(fieldURL, 'Animeka : aucun rΘsultat');
  80.     exit;
  81.     end;
  82.   end;
  83.  
  84. //teste si on a ΘtΘ redirigΘ vers la fiche de l'anime
  85.   BeginPos := Pos('<script language="javascript">document.location.href=', Line);
  86.   if BeginPos <> 0 then
  87.   begin
  88.     Delete(Line, 1, BeginPos+53);
  89.     EndPos := Pos('</script>',Line);
  90.     page_film := 'http://www.animeka.com' + Copy(Line, 1, EndPos-2 );
  91.     if (Pos('fansub',page_film) = 0) then
  92.     begin
  93.       AnalysePageFilm(page_film);
  94.       exit;
  95.     end else
  96.     begin
  97.       AnalyzePageFansub(page_film);
  98.       exit;
  99.     end;
  100.   end;
  101.  
  102. //introduction rΘsultats  
  103.   titre_film := MovieName;
  104.   titre_film := StringReplace(titre_film, #13#10, '');
  105.   titre_film := StringReplace(titre_film, '   ', '');
  106.   titre_film := Trim(titre_film);
  107.   titre_film := AnsiLowerCase(titre_film);
  108.   titre_film := AnsiUpFirstLetter(titre_film);  
  109.   PickTreeAdd('Animes trouvΘs pour ' + titre_film + ' :', '');  
  110.  
  111. //compte les rΘsultats
  112.   compteur := 0;
  113.   
  114.   repeat
  115. //cherche le lien de la page du film
  116.   BeginPos := Pos('<a href="/animes/detail/',Line);
  117.   Delete(Line, 1, BeginPos+8);
  118.   EndPos := Pos('">',Line);
  119.   page_film := 'http://www.animeka.com' + Copy(Line, 1, EndPos-1 );
  120. //cherche le nom du film
  121.   BeginPos := Pos('">',Line);
  122.   Delete(Line, 1, BeginPos+1);
  123.   EndPos := Pos('</b></a>',Line)-1;
  124.   titre_film := Copy(Line, 1, EndPos );
  125.   HTMLdecode(titre_film);
  126.   HTMLremovetags(titre_film);
  127.   titre_film := StringReplace(titre_film, #13#10, '');
  128.   titre_film := StringReplace(titre_film, '   ', '');
  129.   titre_film := Trim(titre_film);
  130.   titre_film := AnsiLowerCase(titre_film);
  131.   titre_film := AnsiUpFirstLetter(titre_film);
  132. //ajoute les films
  133.     PickTreeAdd(titre_film , page_film);
  134.     compteur := compteur+1;
  135. //cherche le lien de la page du film
  136.     BeginPos := Pos('/animes/detail/',Line);
  137.   until BeginPos = 0;
  138.   PickTreeAdd(' ', '');
  139.   PickTreeAdd('Verifier si vous avez la derniΦre version', 'version');
  140.  
  141.   if compteur = 1 then
  142.   begin
  143.     compteur := 0;
  144.     AnalysePageFilm(page_film);
  145.     exit;
  146.   end;
  147.  
  148.  
  149.   if (ConfirmTitre = 0) or (ConfirmTitre = 1) then
  150.   begin
  151.   begin
  152.     if PickTreeExec(Address)=true then
  153.     begin
  154.       if (Address = 'version') then
  155.       begin
  156.         verifVersion();
  157.       end else
  158.       begin
  159.         AnalysePageFilm(Address);
  160.       end;
  161.     end;
  162.   end;
  163.   end else
  164.   begin
  165.     SetField(fieldURL, 'Animeka : rΘsultats multiples');
  166.     exit;
  167.   end;
  168.  
  169. end;
  170.  
  171. //------------------------------------------------------------------------------
  172. // ANALYSE DE LA PAGE FANSUB
  173. //------------------------------------------------------------------------------
  174.  
  175. procedure AnalyzePageFansub(Address: string);
  176. var
  177.   Line ,page_film : string;
  178.   BeginPos, EndPos : Integer;
  179. begin
  180.   Line := GetPage(Address);
  181.   BeginPos := Pos('"animestitle"', Line);
  182.   Delete(Line, 1, BeginPos);
  183.   BeginPos := Pos('a href="', Line);
  184.   Delete(Line, 1, BeginPos+7);
  185.   EndPos := Pos('">',Line);
  186.   page_film := 'http://www.animeka.com' + Copy(Line, 1, EndPos-1 );
  187.   AnalysePageFilm(page_film);
  188. end;
  189.  
  190. //------------------------------------------------------------------------------
  191. // VERIFIER LA VERSION DU SCRIPT
  192. //------------------------------------------------------------------------------
  193.  
  194. procedure verifVersion();
  195. var
  196.    Line, NewVersion, MaVersion, Telecharge : String;
  197.    BeginPos, EndPos : Integer;
  198. begin
  199.   MaVersion := '17';
  200.   Line := GetPage('http://forum.antp.be/phpbb2/viewtopic.php?t=1453');
  201.   BeginPos := pos('TELECHARGER LE SCRIPT ANIMEKA v', Line);
  202.   delete(Line,1, BeginPos+30);
  203.   EndPos := pos('du', Line);
  204.   NewVersion := copy(Line, 1, EndPos - 2);
  205.   PickTreeClear;
  206.   PickTreeAdd('Votre version est la '+MaVersion+', la derniΦre est la '+NewVersion+'.', '');
  207.   PickTreeAdd('Pour tΘlΘcharger la derniΦre version :', '');
  208.   PickTreeAdd('Cliquez ici', 'DL');
  209.   PickTreeAdd('Le script sera tΘlΘcharger dans le mΩme rΘpertoire que votre catalogue', '');
  210.   PickTreeAdd('Cliquez sur annuler pour quitter', '');
  211.   begin
  212.     if PickTreeExec(Telecharge)=true then
  213.       if (Telecharge = 'DL') then
  214.       begin
  215.         GetPicture('http://www.ifrance.com/ricoland/Animeka%20(FR).ifs', True);
  216.       end else
  217.       begin
  218.         exit;
  219.       end;
  220.     end;
  221. end;
  222.  
  223. //------------------------------------------------------------------------------
  224. // ANALYSE DE LA PAGE DU FILM
  225. //------------------------------------------------------------------------------
  226.  
  227. procedure AnalysePageFilm(Address: string);
  228. var
  229.   Line,page_film,titre_film,titre_original, categorie_film, realisateur_film, studio_film, annee_film: string;
  230.   critique, noteRedaction, pays_film, url_film, duree_film, episode_anime, page_episodes, liste_episodes, acteurs_film, liste_acteurs, description_film, reference_film,public_film,video_film,audio_film,fichier_image,aucun:string;
  231.   BeginPos, EndPos, i: Integer;
  232. begin
  233. //pause pour eviter les time out
  234.   sleep(1500);
  235. //charge la page
  236.   Line := GetPage(Address);
  237.   url_film := Address;
  238.  
  239. //cherche le nom du film
  240.   BeginPos := Pos('"animestitle"', Line);
  241.   Delete(Line, 1, BeginPos+39);
  242.   EndPos := Pos('</td>',Line);
  243.   titre_film := Copy(Line, 1, EndPos-1 );
  244.   HTMLdecode(titre_film);
  245.   HTMLremovetags(titre_film);
  246.   titre_film := StringReplace(titre_film, #13#10, '');
  247.   titre_film := StringReplace(titre_film, '   ', '');
  248.   titre_film := Trim(titre_film);
  249.   titre_film := AnsiLowerCase(titre_film);
  250.   titre_film := AnsiMixedCase(titre_film, ' -');
  251.   titre_film := nettoieTitre(titre_film);
  252.  
  253. //chargement des jaquettes
  254.   BeginPos := Pos('<img class="picture" src=', Line);
  255.   if BeginPos <> 0 then
  256.     begin
  257.       Delete(Line, 1, BeginPos+26);
  258.       EndPos := Pos(' width',Line);
  259.       fichier_image := 'http://www.animeka.com/' + Copy(Line, 1, EndPos-2 );
  260. //pour eviter les time-out      
  261.       sleep(1500);
  262.       GetPicture(fichier_image, false);
  263.     end;
  264.  
  265.  //cherche le titre original
  266.    BeginPos := Pos('<td class="animestxt">  ', Line);
  267.    Delete(Line, 1, BeginPos+50);
  268.    EndPos := Pos('</td>',Line);
  269.    titre_original := Copy(Line, 1, EndPos-1 );
  270.    HTMLdecode(titre_original);
  271.    HTMLremovetags(titre_original);
  272.    titre_original := StringReplace(titre_original, #13#10, '');
  273.    titre_original := StringReplace(titre_original, '   ', '');
  274.    titre_original := Trim(titre_original);
  275.    titre_original := AnsiLowerCase(titre_original);
  276.    titre_original := AnsiMixedCase(titre_original, ' ');
  277.    titre_original := AnsiMixedCase(titre_original, '-');
  278.  
  279. //cherche l'annΘe
  280.   BeginPos := Pos('<tr><td class="animestxt">  ', Line);
  281.   Delete(Line, 1, BeginPos+66);
  282.   EndPos := Pos('</td>',Line);
  283.   annee_film := Copy(Line, 1, EndPos-1 );
  284.   duree_film := '';
  285.   i:=pos('-',annee_film);
  286.   if i <> 0 then
  287.   begin
  288.     duree_film := #13#10#13#10 + 'ANN╔ES DE PRODUCTION : ' + annee_film;
  289.     annee_film := copy(annee_film,1,i-1);
  290.     annee_film := Trim(annee_film);
  291.   end;
  292.  
  293. //cherche le studio
  294.   BeginPos := Pos('STUDIO', Line);
  295.   Delete(Line, 1, BeginPos+8);
  296.   EndPos := Pos('</td></tr>',Line);
  297.   studio_film := Copy(Line, 1, EndPos-1 );
  298.   HTMLRemoveTags(studio_film);
  299.   HTMLdecode(studio_film);
  300.   studio_film := StringReplace(studio_film, #13#10, '');
  301.   studio_film := StringReplace(studio_film, '   ', '');
  302.   studio_film := StringReplace(studio_film, '] [', ' - ');
  303.   studio_film := StringReplace(studio_film, '[', '');
  304.   studio_film := StringReplace(studio_film, ']', '');
  305.   studio_film := Trim(studio_film);
  306.   studio_film := AnsiLowerCase(studio_film);
  307.   studio_film := AnsiMixedCase(studio_film, ' -');
  308.  
  309. //cherche la catΘgorie
  310.   BeginPos := Pos('GENRE', Line);
  311.   Delete(Line, 1, BeginPos+8);
  312.   EndPos := Pos('</td></tr>',Line);
  313.   categorie_film := Copy(Line, 1, EndPos-1);
  314.   HTMLRemoveTags(categorie_film);
  315.   HTMLdecode(categorie_film);
  316.   categorie_film := StringReplace(categorie_film, #13#10, '');
  317.   categorie_film := StringReplace(categorie_film, '   ', '');
  318.   categorie_film := StringReplace(categorie_film, '] [', ' - ');
  319.   categorie_film := StringReplace(categorie_film, '[', '');
  320.   categorie_film := StringReplace(categorie_film, ']', '');
  321.   categorie_film := Trim(categorie_film);
  322.   categorie_film := AnsiLowerCase(categorie_film);
  323.   categorie_film := AnsiMixedCase(categorie_film, ' -');
  324.  
  325. //cherche le rΘalisateur
  326.   BeginPos := Pos('AUTEUR : ', Line);
  327.   Delete(Line, 1, (BeginPos-1));
  328.   aucun := Copy(Line, 10, 3 );
  329.   if aucun = 'Non' then
  330.   begin
  331.     realisateur_film := 'Non SpΘcifiΘ';
  332.     end else
  333.   begin
  334.   BeginPos := Pos('.html">', Line);
  335.   Delete(Line, 1, BeginPos+6);
  336.   EndPos := Pos('</a>',Line);
  337.   realisateur_film := Copy(Line, 1, EndPos-1 );
  338.   HTMLdecode(realisateur_film);
  339.   realisateur_film := StringReplace(realisateur_film, #13#10, '');
  340.   realisateur_film := StringReplace(realisateur_film, '   ', '');
  341.   realisateur_film := Trim(realisateur_film);
  342.   realisateur_film := AnsiLowerCase(realisateur_film);
  343.   realisateur_film := AnsiMixedCase(realisateur_film, ' ');
  344.   realisateur_film := AnsiMixedCase(realisateur_film, '-');
  345.   end;
  346.  
  347. //cherche la durΘe
  348.   BeginPos := Pos('DUR', Line);
  349.   Delete(Line, 1, BeginPos-1);
  350.   EndPos := Pos('</td></tr>',Line);
  351.   duree_film := Copy(Line, 1, EndPos-1 ) + duree_film;
  352.   HTMLdecode(duree_film);
  353.   duree_film := StringReplace(duree_film, '   ', '');
  354.   duree_film := Trim(duree_film);
  355. // durΘe dans le champs durΘe
  356.   aucun := duree_film;
  357.   BeginPos := Pos('mins',aucun);
  358.   delete(aucun,1,BeginPos-6);
  359.   BeginPos := Pos(' ',aucun);
  360.   EndPos := Pos(' mins',aucun);
  361.   aucun := copy(aucun,BeginPos+1,EndPos-BeginPos-1);
  362.   aucun := Trim(aucun);
  363.   if aucun <> '' then
  364.     if DureeConst = True then
  365.       SetField(fieldLength,aucun);
  366.  
  367. //cherche le pays
  368.   BeginPos := Pos('show_flag.php', Line);
  369.   Delete(Line, 1, BeginPos);
  370.   BeginPos := Pos('alt=', Line);
  371.   Delete(Line, 1, BeginPos+4);
  372.   EndPos := Pos('"',Line);
  373.   pays_film := Copy(Line, 1, EndPos-1 );
  374.   HTMLdecode(pays_film);
  375.   pays_film := StringReplace(pays_film, #13#10, '');
  376.   pays_film := StringReplace(pays_film, '   ', '');
  377.   pays_film := Trim(pays_film);
  378.   HTMLremovetags(pays_film);
  379.   pays_film := AnsiLowerCase(pays_film);
  380.   pays_film := AnsiMixedCase(pays_film, ' ');
  381.   pays_film := AnsiMixedCase(pays_film, '-');
  382.  
  383. //cherche la description
  384.   BeginPos := Pos('Synopsis', Line);
  385.   Delete(Line, 1, BeginPos+126);
  386.   aucun := Copy(Line, 10, 3 );
  387.   if aucun = 'sp;' then
  388.   begin
  389.     aucun := 'Pas de description pour le moment';
  390.   end else
  391.   begin
  392.   EndPos := Pos('</td></tr></table></td></tr>',Line)-1;
  393.   description_film := Copy(Line, 1, EndPos );
  394.   HTMLdecode(description_film);
  395.   description_film := StringReplace(description_film, #13#10, '');
  396.   description_film := StringReplace(description_film, '<br />',#13#10);
  397.   description_film := StringReplace(description_film, '<b>', '');
  398.   description_film := StringReplace(description_film, '</b>', '');
  399.   description_film := StringReplace(description_film, '<i>', '');
  400.   description_film := StringReplace(description_film, '</i>', '');
  401.   description_film := StringReplace(description_film, '   ', ' '); 
  402.   description_film := StringReplace(description_film, '</div>', ' '); 
  403.   description_film := StringReplace(description_film, '<div class="u">', '');
  404.   description_film := deleteBalise(description_film);
  405.   end;
  406.   
  407. //cherche les critiques
  408.   BeginPos := Pos('Critiques', Line);
  409.   Delete(Line, 1, BeginPos);
  410.   if BeginPos = 0 then
  411.   begin
  412.     critique := 'Pas de critiques pour le moment';
  413.   end else
  414.   begin
  415.     BeginPos := Pos('<td class="animestxt">', Line);
  416.     Delete(Line, 1, BeginPos+21);
  417.     EndPos := Pos('</td></tr></table></td></tr>',Line);
  418.     critique := 'Critiques : ';
  419.     critique := critique + Copy(Line, 1, EndPos-1 );
  420.     HTMLdecode(critique);
  421.     critique := StringReplace(critique, #13#10, ' ');
  422.     critique := StringReplace(critique, '<br />', ' ');
  423.     critique := StringReplace(critique, '<b>', '');
  424.     critique := StringReplace(critique, '</b>', '');
  425.     critique := StringReplace(critique, '<i>', '');
  426.     critique := StringReplace(critique, '</i>', '');
  427.     critique := StringReplace(critique, '   ', ' ');
  428.     critique := deleteBalise(critique);
  429.     description_film := description_film + #13#10#13#10 + critique;
  430.   end;
  431.   
  432. //cherche la note de la rΘdaction
  433.   BeginPos := Pos('Note de la rΘdaction', Line);
  434.   Delete(Line, 1, BeginPos);
  435.   if BeginPos = 0 then
  436.   begin
  437.     noteRedaction := 'Pas de note de la rΘdaction pour le moment';
  438.   end else
  439.   begin
  440.     BeginPos := Pos('<td class="animestxt">', Line);
  441.     Delete(Line, 1, BeginPos+21);
  442.     EndPos := Pos('</td></tr></table></td></tr>',Line);
  443.     noteRedaction := 'Note de la rΘdaction : ';
  444.     noteRedaction := noteRedaction + Copy(Line, 1, EndPos-1 );
  445.     HTMLdecode(noteRedaction);
  446.     noteRedaction := StringReplace(noteRedaction, #13#10, ' ');
  447.     noteRedaction := StringReplace(noteRedaction, '<br />', ' ');
  448.     noteRedaction := StringReplace(noteRedaction, '<b>', '');
  449.     noteRedaction := StringReplace(noteRedaction, '</b>', '');
  450.     noteRedaction := StringReplace(noteRedaction, '<i>', '');
  451.     noteRedaction := StringReplace(noteRedaction, '</i>', '');
  452.     noteRedaction := StringReplace(noteRedaction, '   ', ' ');
  453.     noteRedaction := deleteBalise(noteRedaction);
  454.     description_film := description_film + #13#10#13#10 + noteRedaction;
  455.   end;
  456.   
  457. //cherche les Θpisodes 
  458.   BeginPos := Pos('/animes/epis/', Line);
  459.   Delete(Line, 1, BeginPos-1);
  460.   if BeginPos = 0 then
  461.   begin
  462.     aucun := 'Pas de listing d''Θpisodes pour le moment';
  463.   end else
  464.   begin
  465.     EndPos := Pos('" class',Line);
  466.     page_episodes := 'http://www.animeka.com'+Copy(Line, 1, EndPos-1 );
  467.     premiere_pageEpisode := page_episodes;
  468.     liste_episodes := 'Liste des Θpisodes'+#13#10#13#10;
  469.     la_liste := '';
  470.     TrouveEpisode(page_episodes);
  471.     liste_episodes := liste_episodes + la_liste;
  472.   end;
  473.  
  474. //charge les rΘsultats dans la fenΩtre
  475.   if TitreTraduitConst = True then
  476.     SetField( fieldTranslatedTitle,titre_film);
  477.     if TitreOrignalConst = True then
  478.     SetField( fieldOriginalTitle,titre_original);
  479.   if titre_original = '' then
  480.   begin
  481.     if TitreOrignalConst = True
  482.       SetField( fieldOriginalTitle,titre_film);
  483.   end;
  484.   if AdresseWebConst = True then
  485.     SetField( fieldURL,url_film);
  486.   if CategorieConst = True then
  487.     SetField( fieldCategory,categorie_film);
  488.   if RealisateurConst = True then
  489.     SetField( fieldDirector,realisateur_film);
  490.   if AnneeConst = True then
  491.     SetField( fieldYear,annee_film);
  492.   if PaysConst = True then
  493.     SetField( fieldCountry,pays_film);
  494.   if DureeConst = True then
  495.     SetField( fieldActors,duree_film);
  496.   if SynopsisConst = True then
  497.     SetField( fieldDescription,description_film);
  498.   if StudioConst = True then
  499.     SetField( fieldProducer,studio_film);
  500.   if EpisodeConst = True then
  501.     SetField( fieldComments,liste_episodes);
  502.   DisplayResults;
  503. end;
  504.  
  505. //------------------------------------------------------------------------------
  506. // ANALYSE DE LA PAGE DES EPISODES
  507. //------------------------------------------------------------------------------
  508.  
  509. procedure TrouveEpisode(page_episodes: string);
  510. var
  511.   Line, episode_anime, liste_episodes, aucun, resume, titre_episode:string;
  512.   BeginPos, EndPos, i: Integer;
  513. begin
  514. //pour eviter les time-out
  515.   sleep(1500);
  516. //charge la page
  517.   Line := GetPage(page_episodes);
  518. //compteur
  519.   i := 0;
  520. //liste les Θpisodes
  521.   repeat
  522.   i := i+1;
  523.   BeginPos := Pos('<td class="animestitle" style="padding-left:5px" >', Line);
  524.   Delete(Line, 1, BeginPos+49);
  525.   EndPos := Pos('</td></tr>',Line);
  526.   aucun := Copy(Line, 1, 1 );
  527. //pour n'avoir que les Θpisodes
  528.   if aucun = '<' then
  529.   begin
  530.     exit;
  531.   end else
  532.   begin
  533. //NumΘro et titre Θpisode
  534.     titre_episode := Copy(Line, 1, EndPos-1 );
  535.     titre_episode := deleteKanji(titre_episode);
  536.     titre_episode := StringReplace(titre_episode, #13#10,'');
  537.     la_liste := la_liste + titre_episode + #13#10;
  538. //Pour le rΘsumΘ    
  539.     BeginPos := Pos('<table cellspacing="5"  width="100%"><tr><td class="animestxt">', Line);
  540.     Delete(Line, 1, BeginPos+62);
  541.     EndPos := Pos('</td></tr></table>',Line);
  542.     resume := Copy(Line, 1, EndPos-1 );
  543.     resume := StringReplace(resume, '<br />',' ');    
  544.     resume := StringReplace(resume, #13#10,' ');
  545.     if resume <> '' then
  546.     begin
  547.       la_liste := la_liste + resume + #13#10#13#10;
  548.     end;
  549.   end;
  550.   until i = 25;
  551.  
  552. //Si 25 Θpisodes et + alors page suivante
  553.   if i = 25 then
  554.   begin
  555.     BeginPos := Pos('<td class="animestitle" style="padding-left:5px" >', Line);
  556.     Delete(Line, 1, BeginPos+49);
  557.     EndPos := Pos('</td></tr>',Line);
  558.     aucun := Copy(Line, 1, 1 );
  559. //Si il y a juste 25 Θpisodes
  560.   if aucun = '<' then
  561.   begin
  562.     exit;  
  563.   end else
  564.   begin    
  565. //NumΘro et titre Θpisode
  566.     titre_episode := Copy(Line, 1, EndPos-1 );
  567.     titre_episode := deleteKanji(titre_episode);
  568.     la_liste := la_liste + titre_episode + #13#10;
  569. //Pour le rΘsumΘ    
  570.     BeginPos := Pos('<table cellspacing="5"  width="100%"><tr><td class="animestxt">', Line);
  571.     Delete(Line, 1, BeginPos+62);
  572.     EndPos := Pos('</td></tr></table>',Line);
  573.     resume := Copy(Line, 1, EndPos-1 );
  574.     resume := StringReplace(resume, '<br />',' ');    
  575.     resume := StringReplace(resume, #13#10,' '); 
  576.     if resume <> '' then
  577.     begin
  578.       la_liste := la_liste + resume + #13#10#13#10;
  579.     end;   
  580. //cherche la page suivante
  581.     BeginPos := Pos('PrΘcΘdent', Line);
  582.     Delete(Line, 1, BeginPos+9);
  583.     BeginPos := Pos('/animes/epis/', Line);
  584.     if BeginPos <> 0 then
  585.     begin
  586.       Delete(Line, 1, BeginPos-1);
  587.       EndPos := Pos('">',Line);
  588.       page_episodes := 'http://www.animeka.com'+Copy(Line, 1, EndPos-1 );
  589.       if page_episodes <> premiere_pageEpisode then
  590.       begin
  591.         TrouveEpisode(page_episodes);
  592.       end;
  593.     end;
  594.   end;
  595.   end;
  596. end;
  597.  
  598. //------------------------------------------------------------------------------
  599. // SUPPRESSION DES BALISES
  600. //------------------------------------------------------------------------------
  601.  
  602. function deleteBalise (la_ligne : String) : string;
  603. var
  604.   i,j, fin : Integer;
  605.   la_chaine_sans_balise, aucun : String;
  606. begin
  607.   la_chaine_sans_balise := '';
  608.   fin := Length(la_ligne);
  609.   repeat
  610.   i := pos('<',la_ligne);
  611.   if i <> 0 then
  612.   begin
  613.     aucun := copy(la_ligne,i+1,fin);
  614.     delete(aucun,2,fin);
  615. //pour Ωtre s√r d'avoir affaire α une balise
  616.     if aucun = ' ' then
  617.     begin
  618.       la_chaine_sans_balise := la_chaine_sans_balise + copy (la_ligne,1,i);
  619.       delete(la_ligne,1,i);
  620.     end else
  621.     begin
  622.       j := pos('>',la_ligne);
  623.       fin := Length(la_ligne);
  624.       la_chaine_sans_balise := la_chaine_sans_balise + copy (la_ligne,1,i-1);
  625.       delete(la_ligne,1,j);
  626.     end;
  627.   end;
  628.   until i = 0;
  629.   fin := Length(la_ligne);
  630.   la_chaine_sans_balise := la_chaine_sans_balise + copy (la_ligne,1,fin);
  631.   result := la_chaine_sans_balise;
  632. end;
  633.  
  634. //------------------------------------------------------------------------------
  635. // SUPPRESSION DES CARACTERES JAPONAIS DANS LES NOMS D'EPISODES
  636. //------------------------------------------------------------------------------
  637.  
  638. function deleteKanji (la_ligne : String) : string;
  639. var
  640.   i : Integer;
  641. begin
  642.   i:=pos('&#',la_ligne); // ces symboles caractΘrisent un caractΦre asiatique
  643.   if i <> 0 then
  644.   begin
  645.     la_ligne := copy(la_ligne,1,i-2);
  646.   end;
  647.   result := la_ligne;
  648. end;
  649.  
  650. //------------------------------------------------------------------------------
  651. // NETTOIE TITRE
  652. //------------------------------------------------------------------------------
  653.  
  654. function nettoieTitre(le_titre : String) : string;
  655. var
  656.   i : Integer;
  657. begin
  658.   i:=pos('(1',le_titre);
  659.   if i <> 0 then
  660.   begin
  661.     le_titre := copy(le_titre,1,i-1);
  662.     le_titre := Trim(le_titre);
  663.     result := le_titre;
  664.   end;
  665.   i:= 0;
  666.   i:=pos('(2',le_titre);
  667.   if i <> 0 then
  668.   begin
  669.     le_titre := copy(le_titre,1,i-1);
  670.     le_titre := Trim(le_titre);
  671.     result := le_titre;
  672.   end else
  673.     result := le_titre;
  674. end;
  675.  
  676. //------------------------------------------------------------------------------
  677. // NETTOIE LE TITRE DU FICHIER POUR AVOIR LE TITRE DE FILM
  678. //------------------------------------------------------------------------------
  679.  
  680. function cleanTitle(title : String) : string;
  681. var
  682.   i,j, fin : Integer;
  683.   temp : String;
  684.  
  685. begin
  686.   title := AnsiUpperCase(title);
  687.  
  688.   if title <> '' then
  689.   begin
  690. // Nettoie les tags fichiers, merci Atmosfear pour les tags
  691.   i:=pos('.DVD',title);
  692.   if i <> 0 then
  693.   begin
  694.     title := copy(title,1,i-1);
  695.   end;
  696.   i:=pos('.DIVX',title);
  697.   if i <> 0 then
  698.   begin
  699.     title := copy(title,1,i-1);
  700.   end;
  701.   i:=pos('.FREN',title);
  702.   if i <> 0 then
  703.   begin
  704.     title := copy(title,1,i-1);
  705.   end;
  706.   i:=pos('.GERM',title);
  707.   if i <> 0 then
  708.   begin
  709.     title := copy(title,1,i-1);
  710.   end;
  711.   i:=pos('.INT',title);
  712.   if i <> 0 then
  713.   begin
  714.     title := copy(title,1,i-1);
  715.   end;
  716.   i:=pos('.LIM',title);
  717.   if i <> 0 then
  718.   begin
  719.     title := copy(title,1,i-1);
  720.   end;
  721.   i:=pos('.PROP',title);
  722.   if i <> 0 then
  723.   begin
  724.     title := copy(title,1,i-1);
  725.   end;
  726.   i:=pos('.REPACK',title);
  727.   if i <> 0 then
  728.   begin
  729.     title := copy(title,1,i-1);
  730.   end;
  731.   i:=pos('.SUBB',title);
  732.   if i <> 0 then
  733.   begin
  734.     title := copy(title,1,i-1);
  735.   end;
  736.   i:=pos('.UNSUB',title);
  737.   if i <> 0 then
  738.   begin
  739.     title := copy(title,1,i-1);
  740.   end;
  741.   i:=pos('.WS',title);
  742.   if i <> 0 then
  743.   begin
  744.     title := copy(title,1,i-1);
  745.   end;
  746.   i:=pos('.XVID',title);
  747.   if i <> 0 then
  748.   begin
  749.     title := copy(title,1,i-1);
  750.   end;
  751.   i:=pos('.AC3',title);
  752.   if i <> 0 then
  753.   begin
  754.     title := copy(title,1,i-1);
  755.   end;
  756.   i:=pos('.UNRAT',title);
  757.   if i <> 0 then
  758.   begin
  759.     title := copy(title,1,i-1);
  760.   end;
  761.  
  762.    title := StringReplace(title, '.', ' ');
  763.    title := StringReplace(title, ',', ' ');
  764.    title := StringReplace(title, ':', '');
  765.    title := StringReplace(title, '-', '');
  766.    title := StringReplace(title, '  ', ' ');
  767.  
  768.    i := 0;
  769. // Nettoie les tags de team
  770.    if (pos('(',title) <> 0) then
  771.    begin
  772.      i := pos('(',title);
  773.      temp := copy(title,0,i-1);
  774.      j := pos(')',title);
  775.      fin := Length(title);
  776.      title := temp + copy(title,j+1,fin);
  777.    end;
  778.  
  779.    if (pos('[',title) <> 0) then
  780.    begin
  781.      i := pos('[',title);
  782.      temp := copy(title,1,i-1);
  783.      j := pos(']',title);
  784.      fin := Length(title);
  785.      title := temp + copy(title,j+1,fin);
  786.    end;
  787.  
  788.    title := AnsiLowerCase(title);
  789.    title := AnsiUpFirstLetter(title);
  790.    title := AnsiMixedCase(title,' -');
  791.   end;
  792.    result := title;
  793. end;
  794.  
  795. //------------------------------------------------------------------------------
  796. // PROGRAMME PRINCIPAL
  797. //------------------------------------------------------------------------------
  798.  
  799. begin
  800.   if CheckVersion(3,4,0) then
  801.   begin
  802.     NomFilm := GetField(fieldTranslatedTitle);
  803.     if NomFilm = '' then
  804.       NomFilm := GetField(fieldOriginalTitle);
  805.     NomFilm := cleanTitle(NomFilm);
  806.     if (ConfirmTitre = 0) then
  807.     begin
  808.     if Input('Animeka avec Image by ScorEpioN', 'Entrez le titre de l''anime :', NomFilm) then
  809.     begin
  810.       if Pos('animeka.com', NomFilm) > 0 then
  811.         begin
  812.           AnalysePageFilm(NomFilm);
  813.       end else
  814.       begin
  815.       //remplace les caractΦres accentuΘs
  816.       MovieName := NomFilm;
  817.       NomFilm := AnsiLowerCase(NomFilm);
  818.       NomFilm := StringReplace(NomFilm, 'Θ', 'e');
  819.       NomFilm := StringReplace(NomFilm, 'Φ', 'e');
  820.       NomFilm := StringReplace(NomFilm, 'α', 'a');
  821.       NomFilm := StringReplace(NomFilm, 'τ', 'c');
  822.       NomFilm := StringReplace(NomFilm, '∙', 'u');
  823.       NomFilm := StringReplace(NomFilm, ' ', '+');
  824.       NomFilm := 'http://www.animeka.com/search/index.html?req='+ UrlEncode(NomFilm)+'&zone_series=1&go_search=1&cat=search';
  825.       AnalyzePage(NomFilm);
  826.       end;
  827.     end;
  828.     end else
  829.     begin
  830.       MovieName := NomFilm;
  831.       NomFilm := AnsiLowerCase(NomFilm);
  832.       NomFilm := StringReplace(NomFilm, 'Θ', 'e');
  833.       NomFilm := StringReplace(NomFilm, 'Φ', 'e');
  834.       NomFilm := StringReplace(NomFilm, 'α', 'a');
  835.       NomFilm := StringReplace(NomFilm, 'τ', 'c');
  836.       NomFilm := StringReplace(NomFilm, '∙', 'u');
  837.       NomFilm := StringReplace(NomFilm, ' ', '+');
  838.       if (premiereExecution = 0) then
  839.       begin
  840.           premiereExecution := -1;
  841.       PickTreeClear;
  842.           PickTreeAdd('Vous allez executer le script Animeka sans confirmation', '');
  843.           PickTreeAdd('Cliquez ici pour continuer', 'Oui');
  844.       PickTreeAdd('Cliquez sur annuler pour ne pas executer le script', '');
  845.       begin
  846.         if PickTreeExec(Reponse)=true then
  847.               if (Reponse = 'Oui') then
  848.               begin
  849.               AnalyzePage('http://www.animeka.com/search/index.html?req='+ UrlEncode(NomFilm)+'&zone_series=1&go_search=1&cat=search');
  850.         end;
  851.       end;
  852.       end else
  853.       begin
  854.         AnalyzePage('http://www.animeka.com/search/index.html?req='+ UrlEncode(NomFilm)+'&zone_series=1&go_search=1&cat=search');
  855.       end;
  856.     end;
  857.   end else
  858.     ShowMessage('Ce script requiert une version plus rΘcente de Ant Movie Catalog (au moins la version 3.4.0)');
  859. end. 
  860.